<template>
	<view>
		<u-navbar
			fixed
			safeAreaInsetTop
			:placeholder="placeholder"
			:title="title"
			:autoBack="showBack"
			:leftIcon="showBack ? 'arrow-left': ''"
			:border="false"
			:bgColor="`rgb(255 255 255 / ${isScrollTop}%)`"
		>
		</u-navbar>

	</view>
</template>

<script>
	export default {
		name: 'MyNavBar',
		data() {
			return {
				showBack: false
			}
		},
		props: {
			title: {
				type: String,
				default: ''
			},
			scrollTop: {
				type: Number,
				default: 100
			},
			placeholder: {
				type: Boolean,
				default: true
			},
		},
		computed: {
			isScrollTop() {
				return this.scrollTop > 100 ? 100 : this.scrollTop / 1
			}
		},
		created() {
	
		},
		mounted() {
			let pages = getCurrentPages();
			// 判断有没有上个页面
			if(pages.length >= 2){
				// 显示返回按钮
				this.showBack = true
			}
		},
		methods: {
		}
	}
</script>

<style lang="scss">

</style>